<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/iron-validator-behavior/iron-validator-behavior.html">
<script>
    Polymer({

        is: 'ip-validator',

        behaviors: [
            Polymer.IronValidatorBehavior
        ],

        validate: function(str) {
            if (str && !(/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/.test(str.trim()))) {
                return false;
            }
            return true;
        }

    });

</script>